package com.file.csv.service.impl;

import com.file.csv.pojo.CSV;
import com.file.csv.read.ReadCSV;
import com.file.csv.service.CVSService;
import com.file.csv.write.WriteCSV;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class CVSServiceImpl implements CVSService {


    @Override
    public void readCSV(String path) {
        List<CSV> csvList = ReadCSV.readCsv(path, CSV.class);
        for (CSV csv : csvList) {
            System.out.println(csv.getEnglish());
        }
    }

    @Override
    public void writeCSV(String path) {
        String[] str = {"数字","英文","符号"};
        List<String[]> dataList = new ArrayList<String[]>();
        String[] str1 = {"1","a","%"};
        String[] str2 = {"2","b","*"};
        dataList.add(str1);dataList.add(str2);

        WriteCSV.writeFile(path, str, dataList);
    }


}
